$(function(){
	$('#b_cnName').focus();
    userFormValid();
})
function userFormValid() {
    $("#userForm").validate({
        rules: {
            b_cnName: {
                required: true,
                minlength: 3,
            },
            b_userCode: {
                required: true,
                minlength: 3,
            },
            b_loginName:{
                required: true,
                minlength: 3,
            },
            b_password:{
                required: true,
                minlength: 3,
            }
        },
        errorPlacement: function(error, element) {
            error.appendTo(element.parent());
        },
        errorElement: "span",
        errorClass: "errortips",
        success: 'valid',
        messages: {
            b_cnName: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
            },
            b_userCode: {
                required: " (必填)",
                minlength: " (不能少于 3 个字母)",
            },
            b_loginName:{
                required: " (必填)",
                minlength: " (不能少于 3 个字母)"
            },
            b_password:{
                required: " (必填)",
                minlength: " (不能少于 3 个字母)"
            }
        },
    });
}

function submitForm() {
    if($('#userForm').valid()){
        return false;
    }
    return {};
}
